package com.example.juc.big_talk_concurrent.chapter2.article1;

import java.util.concurrent.locks.ReentrantLock;

public class Client1 {
    ReentrantLock lock = new ReentrantLock();

    public void fun1() {
        lock.lock();
        System.out.println("fun1...");
        fun2();
        lock.unlock();
    }

    private void fun2() {
        // 可重入锁，不会因为锁没有被释放而阻塞
        lock.lock();
        System.out.println("fun2...");
        lock.unlock();
    }

    public static void main(String[] args) {
        Client1 client1 = new Client1();
        client1.fun1();
    }
}
